# -*- coding: utf-8 -*-
# File : job_analysis.py
# Author: taoyahui
# Date : 2021/7/11
from application_factory.extensions import scheduler
from utils import common_util
import re


# 任务解析
def analysis_job():
    jobs = scheduler.get_jobs()
    job_list = []
    for job in jobs:
        job_dict = {
            'name': job.name,
            'next_run_time': common_util.specify_time_format(job.next_run_time),
            'cron': str(job.trigger)
        }
        print(job.trigger)
        job_list.append(job_dict)


def trigger_get(trigger_str):
    string = "cron[day_of_week='0', hour='16', minute='4']"
    p1 = re.compile(r'[[](.*?)[]]', re.S)
    trigger_time = re.findall(p1, string)
    if trigger_str.startswith('cron'):
        execute_fun = 0
    if trigger_str.startswith('interval'):
        execute_fun = 1






if __name__ == '__main__':
    trigger_get("")

